<template>
    <div class="error">
        <img src="../../assets/404.png" alt="">
        <div>
            页面不存在，将在 <span> {{second }}</span> 秒后返回
        </div>
    </div>
</template>

<script setup>
import { ref, reactive, onMounted } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()

const second = ref(4)

onMounted(() => {
    //改变second
    setInterval(() => {
        second.value--
    }, 1000)

    setTimeout(() => {
        router.back()
    }, 4000)
})

</script>

<style scoped lang='less'>
.error{
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    img{
        width: 30%;
    }

    div{
        font-size: 20px;
        margin-top: 20px;
        color: #383838;
        letter-spacing: 3px;
        user-select: none;

        span{
            color:red;
        }
    }
}
</style>